LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-24-2013, 01:57 PM   #1
piacentini
LQ Newbie
 
Registered: May 2013
Posts: 12

Rep: Reputation: Disabled
[request] tidy added to the default php extension set?


As libtidy is already available in the default packages, would it be a good idea to include the

--with-tidy = shared

option in the default php build? I am not sure about the popularity of the extension, but we used it extensively to validate and clean html entered in input forms.
 
Old 06-24-2013, 09:10 PM   #2
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
Quote:
Originally Posted by Mauricio Piacentini View Post
As libtidy is already available in the default packages...
I am pretty sure it isn't. Not in Slackware 14 (or earlier). Is it?

By the way, you probably know you can build a PHP extension (like tidy) without rebuilding all of PHP, right?
 
Old 06-24-2013, 09:53 PM   #3
XGizzmo
Member
 
Registered: Mar 2007
Distribution: Slackware
Posts: 264

Rep: Reputation: 69
tidy gets installed as part of kdewebdev, I am not sure why it is bundled in with kdewebdev. Mauricio, with the way tidy is handled currently I don't think it would be a good idea to make php depend on kdewebdev.
 
Old 06-24-2013, 10:13 PM   #4
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,508

Rep: Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469Reputation: 8469
PHP seems to bundle the tidy source, so perhaps --with-tidy is all it would take.

I'll look into that.
 
Old 06-25-2013, 09:46 AM   #5
piacentini
LQ Newbie
 
Registered: May 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ljb643 View Post
I am pretty sure it isn't. Not in Slackware 14 (or earlier). Is it?

By the way, you probably know you can build a PHP extension (like tidy) without rebuilding all of PHP, right?
Thanks for your reply. I am using vanilla Slackware 14, tidy was probably pulled in by my full install, which includes KDE and kdewebdev.

BTW, I tried to build only the tidy extension using PECL. But the latest version available there is 1.2, for PHP4. So it fails (understandably) as it can not find some PHP includes.

After some research (http://devzone.zend.com/241/tidying-...ml-with-php-5/) I learned that, beginning in PHP5.03, Tidy is now bundled as an extension in the PHP5 source tree, so the usual method is to configure and build it with PHP, which is what I am doing now. I am actually building it in a separate work tree and just copying the tidy.so, but in order to do this I have to use the same php config settings used by the official build to make sure the extension will still load.
 
Old 06-25-2013, 10:05 AM   #6
piacentini
LQ Newbie
 
Registered: May 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by volkerdi View Post
PHP seems to bundle the tidy source, so perhaps --with-tidy is all it would take.

I'll look into that.
Thanks, Patrick. I think it still needs the system libtidy if you configure --with-tidy = shared (I can see a link to libtidy using ldd), but I am not sure if libtidy can be compiled statically into the extension. But as libtidy is already packaged this might not be an issue.
 
Old 06-25-2013, 04:54 PM   #7
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
Tidy itself is not included (bundled) in PHP, neither 5.4.x nor 5.5.x. To build the Tidy extension to PHP, you need the PHP source for the extension (php-<version>/ext/tidy), plus the Tidy source - original source is only available via CVS from sourceforge.net (they do not package up source releases anymore).

You can build the PHP Tidy extension with libtidy compiled as static (libtidy.a, using build/gmake) or shared (libtidy.so).

I did not know about kdewebdev (I don't use it) and that it contains tidy. Thanks for the correction.

You do not need to rebuild PHP to add an extension. There are instructions in README.SELF-CONTAINED-EXTENSIONS within the PHP source distribution. It will be compatible if you follow the steps there. You can just copy the resulting *.so (tidy.so in this case) into the PHP extensions directory, and configure php.ini to load it.
 
Old 06-30-2013, 11:04 AM   #8
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Rep: Reputation: Disabled
Quote:
Originally Posted by ljb643 View Post
Tidy itself is not included (bundled) in PHP, neither 5.4.x nor 5.5.x. To build the Tidy extension to PHP, you need the PHP source for the extension (php-<version>/ext/tidy), plus the Tidy source - original source is only available via CVS from sourceforge.net (they do not package up source releases anymore).

You can build the PHP Tidy extension with libtidy compiled as static (libtidy.a, using build/gmake) or shared (libtidy.so).

I did not know about kdewebdev (I don't use it) and that it contains tidy. Thanks for the correction.

You do not need to rebuild PHP to add an extension. There are instructions in README.SELF-CONTAINED-EXTENSIONS within the PHP source distribution. It will be compatible if you follow the steps there. You can just copy the resulting *.so (tidy.so in this case) into the PHP extensions directory, and configure php.ini to load it.
If not too much work, would you care to guide me through this process? I just reinstalled Slack64-14 onto my home server and I need the tidy extension... Ive found this thread by searching the web for information!

I think explaining for a begineer like me would be beneficial for everyone.. If not, then I can start a separate thread.

Thanks!
 
Old 06-30-2013, 05:37 PM   #9
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
Quote:
Originally Posted by lpallard View Post
If not too much work, would you care to guide me through this process? I just reinstalled Slack64-14 onto my home server and I need the tidy extension... Ive found this thread by searching the web for information!

I think explaining for a begineer like me would be beneficial for everyone.. If not, then I can start a separate thread.

Thanks!
You need the Tidy library (and header files) installed. If you installed it yourself from source, it will be in /usr/local/... and PHP will find it. If you got it from the Slackware KDE package - I'm not sure, you might have to help configure below find it.

You will need the PHP source package, but you only need to extract the PHP Tidy extension, as shown below. Here are my steps to build the PHP Tidy extension. Don't just type these, since your paths etc may differ. "build" is a temporary, empty directory. This also assumes the "phpize" and "phpconfig" commands are on the PATH, as they are with the Slackware package.

Code:
$ cd build
$ tar -xvjf .../php-5.4.16.tar.bz2 php-5.4.16/ext/tidy
$ cd php-5.4.16/ext/tidy
$ phpize
$ ./configure --with-tidy=shared
$ make
The result is modules/tidy.so which you can either use "make install" as root to install, or just copy it to your PHP extensions directory. Change your php.ini to load it. You probably need something like "apachectl restart" to get it to load, and you are done.

Note this works with other PHP extensions too.
 
1 members found this post helpful.
Old 07-01-2013, 12:29 PM   #10
piacentini
LQ Newbie
 
Registered: May 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ljb643 View Post
You need the Tidy library (and header files) installed. If you installed it yourself from source, it will be in /usr/local/... and PHP will find it. If you got it from the Slackware KDE package - I'm not sure, you might have to help configure below find it.
Just to confirm that the procedure you mention works flawlessly on my machine. So it is a simple way to get the extension, thanks for documenting it.
The procedure requires the php source tarball, as you mention, which is the only drawback imo. And you probably need to remember to repeat it when php is upgraded on the system, which would be easier if the extension was included in the default set. But this is a minor annoyance.
 
Old 07-01-2013, 09:30 PM   #11
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Rep: Reputation: Disabled
Quote:
Originally Posted by ljb643 View Post
You need the Tidy library (and header files) installed. If you installed it yourself from source, it will be in /usr/local/... and PHP will find it. If you got it from the Slackware KDE package - I'm not sure, you might have to help configure below find it.

You will need the PHP source package, but you only need to extract the PHP Tidy extension, as shown below. Here are my steps to build the PHP Tidy extension. Don't just type these, since your paths etc may differ. "build" is a temporary, empty directory. This also assumes the "phpize" and "phpconfig" commands are on the PATH, as they are with the Slackware package.

Code:
$ cd build
$ tar -xvjf .../php-5.4.16.tar.bz2 php-5.4.16/ext/tidy
$ cd php-5.4.16/ext/tidy
$ phpize
$ ./configure --with-tidy=shared
$ make
The result is modules/tidy.so which you can either use "make install" as root to install, or just copy it to your PHP extensions directory. Change your php.ini to load it. You probably need something like "apachectl restart" to get it to load, and you are done.

Note this works with other PHP extensions too.
Extremely well explained! Worked like a charm ! Many thanks!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
want to disable htaccess from updating the default php values set in php.ini nikeshp Linux - Software 2 05-26-2013 08:09 PM
PHP 5.1.6 + tidy 1.2 module Ateo Linux - Server 1 08-22-2008 01:21 PM
Add tidy to php in RedHat Enterprise 5.1 ?? PrimeMogul Red Hat 4 05-16-2008 09:02 AM
LXer: Tidy URL Rewrites with PHP LXer Syndicated Linux News 0 02-21-2007 10:46 PM
HTML Tidy and PHP 4 atom Programming 0 10-01-2004 10:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration